#include <functional>
#include <iostream>
#include <numeric>
int func(int a, int b) { return a + b; }
struct func_obj {
  int operator()(int a, int b) { return a + b; };
} func_obj;
int main() {
  int data[] = {1, 3, 6, 4, 8, 9, 2};
  int *result = new int[7];
  std::adjacent_difference(data, data + 7, result);
  std::adjacent_difference(data, data + 7, result, func); // 1 4 9 10 12 17 11

  std::adjacent_difference(data, data + 7, result,
                           func_obj); // 1 4 9 10 12 17 11
  std::adjacent_difference(data, data + 7, result,
                           std::minus<int>()); // 1 2 3 -2 4 1 -7
  delete[] result;
}
